# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-stix2-patterns
_pkgname=cti-pattern-validator
pkgver=2.0.0
pkgrel=5
pkgdesc='Validate STIX 2 Patterns.'
url='https://github.com/oasis-open/cti-pattern-validator'
license=('BSD')
arch=('any')
depends=('python' 'python-antlr4' 'python-six' 'python-typing')
makedepends=('git' 'python-setuptools' 'python-pip' 'python-wheel')
source=("https://github.com/oasis-open/cti-pattern-validator/archive/v$pkgver.tar.gz")
sha512sums=('6ee476ff7f00a093820fd39aa7ae208900a861c18c8d8d70e24e97292668fbaea8071e2a31c4ed686865be8b44301c5a0bb164bffa182f40fafb7ad5ae2123a8')

pkgver() {
  git ls-remote --sort=v:refname -t --refs "$url" 'v*' \
  | sed -e 's/.*v//' -e '$!d'
}

build() {
  cd "$_pkgname-$pkgver"

  python setup.py build
}

package() {
  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

